import { ElNotification } from 'element-plus'
import CryptoJS from 'crypto-js'

//消息提示
export function toast(message,type='success', dangerouslyUseHTMLString = false){
    ElNotification({
        message,
        type,
        dangerouslyUseHTMLString,
        duration:3000
    })
}

//加密
export function encrypt(data){
    let ciphertext = CryptoJS.AES.encrypt(data, 'greyson18823055').toString()
    return ciphertext;
}

//解密
export function decrypt(ciphertext){
    var bytes  = CryptoJS.AES.decrypt(ciphertext, 'greyson18823055');
    var originalText = bytes.toString(CryptoJS.enc.Utf8);
    return originalText;
}